* Rep_Time dependent censoring - patient sex.sps.
* Written by PSKL on 1/4/03.

Match files file='D:\Longitudinal Data\Rep_Claims Master 1991 to 2001.sav'
  /table = 'D:\Longitudinal Data\Rep_Patient Master 1991 to 2001.sav'
  /by patidn.


* Create year/month variable and schednum to number of months.
* Then calculate observation interval in months to next schednum if revisit or 10203 if not.

Compute lstmsn=(lastyear-1900)*100 + lastmont.
Compute schedym=trunc(schednum/100)*12 + schednum - 100*trunc(schednum/100).
Compute lastym = (lastyear-1900)*12 + lastmont.


sort cases by patidn (a) schednum lastym (d).

compute revisit = 0.
if (patidn=lag(patidn)) revisit = 1.

compute  interval = 12*102+3 - lastym.
if (patidn=lag(patidn))interval = lag(schedym) - lastym.

formats patidn claimidn (F10) lstmsn interval (F6) revisit (F1).

save outfile='d:\temp1.sav'
/keep patidn claimidn lstmsn schednum interval revisit patsex.

get file='d:\temp1.sav'.

CROSSTABS
  /TABLES=interval  BY revisit By patsex
  /FORMAT= AVALUE TABLES
  /CELLS= COUNT .

Crosstabs

Notes
Output Created 04-JUN-2003 14:18:30
Comments
Input Data d:\temp1.sav
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 710052
Missing Value Handling Definition of Missing User-defined missing values are treated as missing.
Cases Used Statistics for each table are based on all the cases with valid data in the specified range(s) for all variables in each table.
Syntax CROSSTABS
/TABLES=interval BY revisit By patsex
/FORMAT= AVALUE TABLES
/CELLS= COUNT .
Resources Dimensions Requested 3
Cells Available 95325
Elapsed Time 0:00:06.11

Case Processing Summary

Cases
Valid Missing Total
N Percent N Percent N Percent
INTERVAL * REVISIT * PATSEX 710052 100.0% 0 .0% 710052 100.0%


INTERVAL * REVISIT * PATSEX Crosstabulation
Count

REVISIT Total
PATSEX 0 1
F INTERVAL 0 539 559 1098
1 2220 8659 10879
2 2697 19113 21810
3 1966 21872 23838
4 2580 24717 27297
5 2420 21770 24190
6 1930 27662 29592
7 1445 59897 61342
8 1191 45396 46587
9 1014 27602 28616
10 877 18172 19049
11 634 12516 13150
12 706 9856 10562
13 535 8379 8914
14 572 6923 7495
15 366 5518 5884
16 471 4570 5041
17 408 3707 4115
18 414 3079 3493
19 356 2587 2943
20 329 2288 2617
21 326 1953 2279
22 340 1775 2115
23 265 1634 1899
24 314 1476 1790
25 318 1354 1672
26 241 1222 1463
27 234 1043 1277
28 269 894 1163
29 260 876 1136
30 259 730 989
31 223 721 944
32 240 638 878
33 257 549 806
34 206 531 737
35 227 513 740
36 228 452 680
37 179 410 589
38 183 408 591
39 180 373 553
40 240 320 560
41 215 321 536
42 239 313 552
43 197 279 476
44 225 277 502
45 222 241 463
46 201 222 423
47 210 220 430
48 217 193 410
49 197 219 416
50 184 177 361
51 185 168 353
52 172 176 348
53 185 174 359
54 192 145 337
55 143 127 270
56 164 137 301
57 177 116 293
58 180 129 309
59 168 139 307
60 176 117 293
61 168 132 300
62 178 129 307
63 148 84 232
64 171 97 268
65 164 106 270
66 196 81 277
67 160 79 239
68 191 72 263
69 181 71 252
70 174 73 247
71 184 66 250
72 196 54 250
73 159 60 219
74 152 65 217
75 121 56 177
76 195 51 246
77 160 46 206
78 176 57 233
79 149 43 192
80 171 49 220
81 170 42 212
82 173 36 209
83 157 45 202
84 177 28 205
85 164 46 210
86 150 30 180
87 122 27 149
88 160 28 188
89 162 27 189
90 164 33 197
91 152 39 191
92 153 21 174
93 145 22 167
94 141 19 160
95 141 25 166
96 175 29 204
97 139 14 153
98 136 16 152
99 110 19 129
100 126 21 147
101 133 13 146
102 150 16 166
103 133 23 156
104 158 16 174
105 169 12 181
106 125 14 139
107 161 11 172
108 167 9 176
109 129 9 138
110 143 7 150
111 134 7 141
112 170 7 177
113 149 10 159
114 150 9 159
115 122 9 131
116 155 5 160
117 113 4 117
118 110 3 113
119 143 3 146
120 120 4 124
121 119 7 126
122 102 7 109
123 95 6 101
124 110
110
125 118 3 121
126 107 3 110
127 90 5 95
128 91 2 93
129 77
77
130 101 2 103
131 102
102
132 99 1 100
133 82
82
134 75
75
Total 43121 358869 401990
M INTERVAL 0 422 456 878
1 1770 6444 8214
2 2198 13818 16016
3 1620 15524 17144
4 2034 17290 19324
5 1939 15214 17153
6 1591 20035 21626
7 1161 46351 47512
8 959 34534 35493
9 834 20089 20923
10 714 13274 13988
11 556 8896 9452
12 610 7225 7835
13 465 6358 6823
14 489 5195 5684
15 367 4238 4605
16 403 3585 3988
17 377 2895 3272
18 341 2483 2824
19 294 2220 2514
20 330 1924 2254
21 321 1710 2031
22 286 1533 1819
23 245 1392 1637
24 324 1350 1674
25 272 1147 1419
26 266 1063 1329
27 224 979 1203
28 260 782 1042
29 228 776 1004
30 239 710 949
31 188 629 817
32 225 582 807
33 207 528 735
34 191 525 716
35 212 491 703
36 261 446 707
37 208 414 622
38 197 411 608
39 155 338 493
40 199 357 556
41 207 318 525
42 200 319 519
43 160 283 443
44 206 292 498
45 176 232 408
46 159 238 397
47 177 236 413
48 187 200 387
49 178 222 400
50 199 214 413
51 136 205 341
52 155 176 331
53 183 174 357
54 159 170 329
55 144 156 300
56 195 146 341
57 157 139 296
58 142 162 304
59 143 143 286
60 148 140 288
61 149 125 274
62 164 129 293
63 132 112 244
64 151 108 259
65 159 82 241
66 137 88 225
67 132 87 219
68 174 95 269
69 143 96 239
70 150 84 234
71 141 81 222
72 142 72 214
73 163 75 238
74 143 77 220
75 124 73 197
76 164 68 232
77 163 77 240
78 153 63 216
79 141 67 208
80 141 62 203
81 145 63 208
82 155 52 207
83 110 48 158
84 158 37 195
85 149 58 207
86 149 43 192
87 123 50 173
88 113 34 147
89 132 47 179
90 142 35 177
91 136 30 166
92 119 33 152
93 123 33 156
94 120 26 146
95 125 30 155
96 140 25 165
97 120 24 144
98 127 22 149
99 115 35 150
100 125 29 154
101 118 25 143
102 135 17 152
103 118 22 140
104 120 10 130
105 125 28 153
106 122 14 136
107 121 13 134
108 142 19 161
109 123 12 135
110 142 10 152
111 114 13 127
112 141 12 153
113 133 16 149
114 135 11 146
115 92 13 105
116 137 13 150
117 109 8 117
118 110 9 119
119 107 4 111
120 114 7 121
121 115 5 120
122 96 4 100
123 77 1 78
124 91 3 94
125 109 4 113
126 105 4 109
127 66 3 69
128 87 1 88
129 81 1 82
130 75
75
131 98 2 100
132 92 2 94
133 75
75
134 95
95
Total 36905 271157 308062

Aggregate outfile=*
 /break interval revisit patsex
 /n=n.

sort cases by patsex (a) interval revisit (d).
compute cases=n.
if (revisit=0 and lag(patsex)=patsex and lag(interval)=interval) cases=n+lag(n).
execute.
select if revisit=0.
compute reattend=cases-n.

compute cumcases=cases.
compute cumreatt=reattend.

do if ($casenum > 1 and Lag (patsex) = patsex).
compute cumcases=cumcases+lag(cumcases).
compute cumreatt=cumreatt + lag(cumreatt).
end if.

compute prreatt=cumreatt/cumcases.
sort cases by patsex interval.

save outfile='D:\Longitudinal Data\Rep_reattendance probability patsex.sav'
  /DROP=revisit n cases reattend cumcases cumreatt /COMPRESSED.

GRAPH
  /LINE(MULTIPLE)MEAN(prreatt) BY interval BY patsex
  /MISSING=REPORT.

Graph

Notes
Output Created 04-JUN-2003 14:18:41
Comments
Input File Label Aggregated File
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 270
Syntax GRAPH
/LINE(MULTIPLE)MEAN(prreatt) BY interval BY patsex
/MISSING=REPORT.
Resources Elapsed Time 0:00:00.13

Line of mean(prreatt) by interval patsex